# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.PubSubLite.V1.Model.RetentionConfig do
  @moduledoc """
  The settings for a topic's message retention.

  ## Attributes

  *   `perPartitionBytes` (*type:* `String.t`, *default:* `nil`) - The provisioned storage, in bytes, per partition. If the number of bytes stored in any of the topic's partitions grows beyond this value, older messages will be dropped to make room for newer ones, regardless of the value of `period`.
  *   `period` (*type:* `String.t`, *default:* `nil`) - How long a published message is retained. If unset, messages will be retained as long as the bytes retained for each partition is below `per_partition_bytes`.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :perPartitionBytes => String.t() | nil,
          :period => String.t() | nil
        }

  field(:perPartitionBytes)
  field(:period)
end

defimpl Poison.Decoder, for: GoogleApi.PubSubLite.V1.Model.RetentionConfig do
  def decode(value, options) do
    GoogleApi.PubSubLite.V1.Model.RetentionConfig.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.PubSubLite.V1.Model.RetentionConfig do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
